﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Message.ascx.cs" Inherits="PayrollHR.Administration.Modules.MessageControl" %>
<%@ Register Src="ConfirmationBox.ascx" TagName="ConfirmationBox" TagPrefix="uc2" %>
<%@ Register Src="ToolTipLabelControl.ascx" TagName="ToolTipLabelControl" TagPrefix="uc1" %>
<%@ Register Src="DatePicker.ascx" TagName="DatePicker" TagPrefix="uc3" %>
<script type="text/javascript">
    $(window).bind('load', function () {
        var cbHeader = $(".cbHeader input");
        var cbRowItem = $(".cbRowItem input");
        cbHeader.bind("click", function () {
            cbRowItem.each(function () { this.checked = cbHeader[0].checked; })
        });
        cbRowItem.bind("click", function () { if ($(this).checked == false) cbHeader[0].checked = false; });
    });
    function ClearText() {
        document.getElementById('<%=txtCustomerName.ClientID%>').value = '';
        document.getElementById('<%=txtPackName.ClientID%>').value = '';
        document.getElementById('<%=txtMaCode.ClientID%>').value = '';
        document.getElementById('<%=txtCustName.ClientID%>').value = '';
        document.getElementById('<%=txtCustEmail.ClientID%>').value = '';
        document.getElementById('<%=txtTaxcode.ClientID%>').value = '';
        document.getElementById('<%=txtMobile.ClientID%>').value = '';
    };
    function expandcollapse(obj, row) {
        var div = document.getElementById(obj);
        var img = document.getElementById('img' + obj);

        if (div.style.display == "none") {
            div.style.display = "block";
            if (row == 'alt') {
                img.src = "../../images/minus.gif";
            }
            else {
                img.src = "../../images/minus.gif";
            }
            img.alt = "Close to view other Customers";
        }
        else {
            div.style.display = "none";
            if (row == 'alt') {
                img.src = "../../images/plus.gif";
            }
            else {
                img.src = "../../images/plus.gif";
            }
            img.alt = "Expand to show Orders";
        }
    }
</script>
<div class="section-header">
    <div class="title">
        <%=GetLocaleResourceString("Admin.CusomerResultManager.ManagerCustomerResult")%>
    </div>
    <div class="options">
        <asp:Button ID="btnFilter" runat="server" Text="Filter" OnClick="btnFilter_Click"
            CssClass="adminButtonBlue" ToolTip="Filter" />
        <asp:Button ID="btnConfirm" runat="server" Text="Confirm And SendMail" OnClick="btnConfirm_Click"
            CssClass="adminButtonBlue" ToolTip="Send to Queued And SendMail each 60s." />
        <uc2:ConfirmationBox ID="cbConfirm" runat="server" TargetControlID="btnConfirm"
            YesText="<% $PayrollResources:Admin.Common.Yes %>" NoText="<% $PayrollResources:Admin.Common.No %>"
            ConfirmText="<% $PayrollResources:Admin.Common.ConfimAndSendMail %>" />
        <asp:Button runat="server" Text="Delete" CssClass="adminButtonBlue" ID="btnDelete" ToolTip="Delete Mail" OnClick="btnDelete_Click" />
        <uc2:ConfirmationBox ID="cbDelete" runat="server" TargetControlID="btnDelete"
            YesText="<% $PayrollResources:Admin.Common.Yes %>" NoText="<% $PayrollResources:Admin.Common.No %>"
            ConfirmText="<% $PayrollResources:Admin.Common.AreYouSure %>" />
    </div>
</div>
<div>
    <div style="border: 1px solid #2F00FF; border-radius: 15px;">
        <table>
            <tr>
                <td>
                    <div class="title">
                        <table style="width: auto">
                            <tr id="row1">
                                <td class="adminTitle">
                                    <uc1:ToolTipLabelControl runat="server" ID="ToolTipLabelControl2" Text="<% $PayrollResources:Admin.CustomerSearch.From.Text %>" ToolTip="<% $PayrollResources:Admin.CustomerSearch.From.ToolTip %>"
                                        ToolTipImage="~/Administration/Common/ico-help.gif" />
                                </td>
                                <td class="adminData">
                                    <uc3:DatePicker ID="dpFromdate" runat="server" />
                                </td>
                                <td class="adminTitle">
                                    <uc1:ToolTipLabelControl runat="server" ID="ToolTipLabelControl3" Text="<% $PayrollResources:Admin.CustomerSearch.To.Text %>" ToolTip="<% $PayrollResources:Admin.CustomerSearch.To.ToolTip %>"
                                        ToolTipImage="~/Administration/Common/ico-help.gif" />
                                </td>
                                <td class="adminData">
                                    <uc3:DatePicker ID="dpTodate" runat="server" />
                                </td>
                            </tr>
                            <tr>
                                <td class="adminTitle">
                                    <uc1:ToolTipLabelControl runat="server" ID="lblChannelTitle" Text="<% $PayrollResources:Admin.CustomerSearch.Distributor.Text %>" ToolTip="<% $PayrollResources:Admin.CustomerSearch.Distributor.ToolTip %>"
                                        ToolTipImage="~/Administration/Common/ico-help.gif" />
                                </td>
                                <td class="adminData">
                                    <asp:TextBox ID="txtCustomerName" CssClass="adminInput" runat="server"></asp:TextBox>
                                </td>
                                <td class="adminTitle">
                                    <uc1:ToolTipLabelControl ID="lblCustEmail" runat="server" Text="<% $PayrollResources:Admin.ResultSearchInfo.DistributorEmail.Text %>"
                                        ToolTip="<% $PayrollResources:Admin.ResultSearchInfo.DistributorEmail.ToolTip %>" ToolTipImage="~/Administration/Common/ico-help.gif" />
                                </td>
                                <td class="adminData">
                                    <asp:TextBox ID="txtCustEmail" CssClass="adminInput" runat="server"></asp:TextBox>
                                </td>
                            </tr>

                            <tr>

                                <td class="adminTitle">
                                    <uc1:ToolTipLabelControl ID="ToolTipLabelControl4" runat="server" Text="<% $PayrollResources:Admin.CustomerInfo.CustMobile.Text %>"
                                        ToolTip="<% $PayrollResources:Admin.CustomerInfo.CustMobile.ToolTip %>" ToolTipImage="~/Administration/Common/ico-help.gif" />
                                </td>
                                <td class="adminData">
                                    <asp:TextBox ID="txtMobile" CssClass="adminInput" runat="server"></asp:TextBox>
                                </td>
                                <td class="adminTitle">
                                    <uc1:ToolTipLabelControl runat="server" ID="ToolTipLabelControl5" Text="<% $PayrollResources:Admin.CustomerSearch.Confirm.Text %>" ToolTip="<% $PayrollResources:Admin.CustomerSearch.Confirm.ToolTip %>"
                                        ToolTipImage="~/Administration/Common/ico-help.gif" />
                                </td>
                                <td class="adminData">
                                    <asp:CheckBox ID="ckConfirm" runat="server" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
                <td>
                    <div class="title">
                        <table style="width: auto">
                            <tr>
                                <td class="adminTitle">
                                    <uc1:ToolTipLabelControl runat="server" ID="ToolTipLabelControl6" Text="<% $PayrollResources:Admin.CustomerSearch.CustName.Text %>" ToolTip="<% $PayrollResources:Admin.CustomerSearch.CustName.ToolTip %>"
                                        ToolTipImage="~/Administration/Common/ico-help.gif" />
                                </td>
                                <td class="adminData">
                                    <asp:TextBox ID="txtCustName" CssClass="adminInput" runat="server"></asp:TextBox>
                                </td>
                                <td class="adminTitle">
                                    <uc1:ToolTipLabelControl ID="lblCustCompany" runat="server" Text="<% $PayrollResources:Admin.CustomerInfo.CustTaxCode.Text %>"
                                        ToolTip="<% $PayrollResources:Admin.CustomerInfo.CustTaxCode.ToolTip %>" ToolTipImage="~/Administration/Common/ico-help.gif" />
                                </td>
                                <td class="adminData">
                                    <asp:TextBox ID="txtTaxcode" runat="server" MaxLength="32" CssClass="adminInput"></asp:TextBox>
                                </td>
                            </tr>

                            <tr>
                                <td class="adminTitle">
                                    <uc1:ToolTipLabelControl ID="ToolTipLabelControl1" runat="server" Text="<% $PayrollResources:Admin.CustomerResultInfo.MaCode.Text %>"
                                        ToolTip="<% $PayrollResources:Admin.CustomerResultInfo.MaCode.ToolTip %>" ToolTipImage="~/Administration/Common/ico-help.gif" />
                                </td>
                                <td class="adminData">
                                    <asp:TextBox ID="txtMaCode" CssClass="adminInput" runat="server"></asp:TextBox>
                                </td>
                                <td class="adminTitle">
                                    <uc1:ToolTipLabelControl ID="lblCustMobile" runat="server" Text="<% $PayrollResources:Admin.CustomerResultInfo.PackName.Text %>"
                                        ToolTip="<% $PayrollResources:Admin.CustomerResultInfo.PackName..ToolTip %>" ToolTipImage="~/Administration/Common/ico-help.gif" />
                                </td>
                                <td class="adminData">
                                    <asp:TextBox ID="txtPackName" CssClass="adminInput" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="adminTitle"></td>
                                <td class="adminData"></td>
                                <td class="adminTitle"></td>
                                <td class="adminData">
                                    <a id="aCleare" href="javascript:ClearText()">Xóa Tìm Kiếm</a>
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
        </table>

    </div>
</div>
<p></p>
<div>
    <asp:GridView ID="gvMessage" runat="server" ForeColor="#333333" GridLines="None" AutoGenerateColumns="False" Width="100%" DataKeyNames="MessageID" AllowPaging="True"
        OnRowDataBound="gvMessage_RowDataBound" OnPageIndexChanging="gvMessage_PageIndexChanging">
        <RowStyle BorderStyle="None" />
        <Columns>
            <asp:TemplateField ItemStyle-Width="0.5%" ItemStyle-HorizontalAlign="Center">
                <HeaderTemplate>
                    <asp:CheckBox ID="cbSelectAll" runat="server" CssClass="cbHeader" />
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbMessage" runat="server" CssClass="cbRowItem" ToolTip="<% $PayrollResources:Admin.Customers.Result.ToolTip %>" />
                    <asp:HiddenField ID="hfMessageID" runat="server" Value='<%# Eval("MessageID") %>' />
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Center" Width="0.5%" />
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="0.5%">
                <ItemTemplate>
                    <a href="javascript:expandcollapse('div<%# Eval("MessageID") %>', 'one');">
                        <img id='imgdiv<%# Eval("MessageID") %>' alt="Click to show/hide Orders for Customer <%# Eval("MessageID") %>" width="11" border="0" src="../../images/plus.gif" />
                    </a>
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Center" Width="0.5%" />
            </asp:TemplateField>
            <asp:TemplateField ItemStyle-Width="2%" HeaderText="T.Thái">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblConfirmName" Text='<%#Eval("ConfirmName") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Center" Width="2%" />
            </asp:TemplateField>

            <asp:TemplateField HeaderText="NPP" ItemStyle-Width="6%">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblDistributor" Text='<%#Eval("Distributor") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle Width="10%" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Chủ đề" ItemStyle-Width="6%">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblSubject" Text='<%#Eval("Subject") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle Width="10%" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Nội dung" ItemStyle-Width="10%">
                <ItemTemplate>
                    <asp:TextBox ID="txtBody" runat="server" ReadOnly="true" TextMode="MultiLine" Width="98%" Text='<%# Eval("Body") %>'></asp:TextBox>
                </ItemTemplate>
                <ItemStyle Width="10%" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Ngày gửi" ItemStyle-Width="4%">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblDateSent" Text='<%#Eval("DateSent") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle Width="4%" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Ngày Nhận" ItemStyle-Width="4%">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblResDateReceive" Text='<%#Eval("ResDateReceive") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle Width="4%" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Người gửi" ItemStyle-Width="10%">
                <ItemTemplate>
                    <asp:Label runat="server" ID="lblFrommail" Text='<%#Eval("Frommail") %>'></asp:Label>
                    <tr>
                        <td colspan="9">
                            <div id='div<%# Eval("MessageID") %>' style="display: none; position: relative; left: 15px; OVERFLOW: auto; WIDTH: 97%">
                                <asp:GridView ID="gvMail" runat="server" ForeColor="#333333" CellPadding="4" AutoGenerateColumns="False" Width="100%" DataKeyNames="MessageID" AllowPaging="True"
                                    PageSize="30" OnRowUpdating="gvMail_RowUpdating" OnRowEditing="gvMail_RowEditing" OnRowCancelingEdit="gvMail_RowCancelingEdit" OnPageIndexChanging="gvMail_PageIndexChanging"
                                    OnRowCommand="gvMail_RowCommand" OnRowDeleting="gvMail_RowDeleting" OnRowDeleted="gvMail_RowDeleted" ShowFooter="true">
                                    <Columns>
                                        <asp:TemplateField HeaderText="Tên Khách Hàng" ItemStyle-Width="16%">
                                            <ItemTemplate>
                                                <asp:Label runat="server" ID="lblCustomerName" Text='<%#Eval("CustomerName") %>'></asp:Label>
                                                <asp:HiddenField ID="hfMessageID" runat="server" Value='<%# Eval("MessageID") %>' />
                                                <asp:HiddenField ID="hfResultsId" runat="server" Value='<%# Eval("ResultsId") %>' />
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <asp:TextBox ID="txtCustomerName" runat="server" BackColor="Yellow" TextMode="MultiLine" Width="100%" Text='<%# Eval("CustomerName") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtCustomerName" TextMode="MultiLine" BackColor="YellowGreen" Text="" runat="server"></asp:TextBox>
                                            </FooterTemplate>
                                            <ItemStyle Width="16%" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Tax Code"
                                            HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="6%" ItemStyle-HorizontalAlign="Left">
                                            <ItemTemplate>
                                                <asp:Label runat="server" ID="lblTaxCode" Text='<%#Eval("TaxCode") %>'></asp:Label>
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <asp:TextBox ID="txtTaxCode" runat="server" BackColor="Yellow" TextMode="MultiLine" Width="100%" Text='<%# Eval("TaxCode") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtTaxCode" Text="" BackColor="YellowGreen" runat="server"></asp:TextBox>
                                            </FooterTemplate>
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Left" Width="6%" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Mobile"
                                            HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="7%" ItemStyle-HorizontalAlign="Left">
                                            <ItemTemplate>
                                                <asp:Label runat="server" ID="lblMobile" Text='<%#Eval("Mobile") %>'></asp:Label>
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <asp:TextBox ID="txtMobile" runat="server" BackColor="Yellow" TextMode="MultiLine" Width="100%" Text='<%# Eval("Mobile") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtMobile" Text="" BackColor="YellowGreen" runat="server"></asp:TextBox>
                                            </FooterTemplate>
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Left" Width="7%" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Ngày"
                                            HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="7%" ItemStyle-HorizontalAlign="Left">
                                            <ItemTemplate>
                                                <asp:Label runat="server" ID="lblDatePurchase" Text='<%#Eval("DatePurchase") %>' ToolTip="dd/MM/yyyy"></asp:Label>
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <asp:TextBox ID="txtDatePurchase" runat="server" BackColor="Yellow" TextMode="MultiLine" Width="100%" ToolTip="dd/MM/yyyy" Text='<%# Eval("DatePurchase") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtDatePurchase" Text="" BackColor="YellowGreen" runat="server"></asp:TextBox>
                                            </FooterTemplate>
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Left" Width="7%" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Mã Code"
                                            HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="8%" ItemStyle-HorizontalAlign="Left">
                                            <ItemTemplate>
                                                <asp:Label runat="server" ID="lblPackageCode" Text='<%#Eval("PackageCode") %>'></asp:Label>
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <asp:TextBox ID="txtPackageCode" runat="server" BackColor="Yellow" Width="100%" TextMode="MultiLine" Text='<%# Eval("PackageCode") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtPackageCode" Text="" BackColor="YellowGreen" runat="server"></asp:TextBox>
                                            </FooterTemplate>
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Left" Width="8%" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Tên Gói"
                                            HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="7%" ItemStyle-HorizontalAlign="Left">
                                            <ItemTemplate>
                                                <asp:Label runat="server" ID="lblName" Text='<%#Eval("Name") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Left" Width="7%" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Địa Chỉ"
                                            HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="8%" ItemStyle-HorizontalAlign="Left">
                                            <ItemTemplate>
                                                <asp:Label runat="server" ID="lblAddress" Text='<%#Eval("Address") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Left" Width="8%" />
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtAddress" Text="" BackColor="YellowGreen" runat="server"></asp:TextBox>
                                            </FooterTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Phí"
                                            HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Left">
                                            <ItemTemplate>
                                                <asp:Label runat="server" ID="lblServiceFree" Text='<%#Eval("ServiceFree") %>'></asp:Label>
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Left" Width="10%" />
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtServiceFree" Text="" BackColor="YellowGreen" runat="server"></asp:TextBox>
                                            </FooterTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Hồ sơ"
                                            HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Left">
                                            <ItemTemplate>
                                                <asp:Label runat="server" ID="lblCustomerProfile" Text='<%#Eval("CustomerProfile") %>'></asp:Label>
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <asp:TextBox ID="txtCustomerProfile" runat="server" BackColor="Yellow" Width="100%" TextMode="MultiLine" Text='<%# Eval("CustomerProfile") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Left" Width="10%" />
                                            <FooterTemplate>
                                                <asp:TextBox ID="txtCustomerProfile" Text="" BackColor="YellowGreen" runat="server"></asp:TextBox>
                                            </FooterTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Edit" ShowHeader="false" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Left">
                                            <ItemTemplate>
                                                <asp:LinkButton ID="btnedit" runat="server"
                                                    CommandName="Edit" Text="Edit"></asp:LinkButton>
                                                <asp:LinkButton ID="lbtDelete" runat="server"
                                                    CommandName="Delete" Text="Delete"></asp:LinkButton>
                                                <uc2:ConfirmationBox ID="cblbtDelete" runat="server" TargetControlID="lbtDelete"
                                                    YesText="<% $PayrollResources:Admin.Common.Yes %>" NoText="<% $PayrollResources:Admin.Common.No %>"
                                                    ConfirmText="<% $PayrollResources:Admin.Common.AreYouSure %>" />
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <asp:LinkButton ID="btnupdate" runat="server"
                                                    CommandName="Update" Text="Update"></asp:LinkButton>
                                                <asp:LinkButton ID="btncancel" runat="server"
                                                    CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                                            </EditItemTemplate>
                                            <ItemStyle HorizontalAlign="Left" Width="5%" />
                                            <FooterTemplate>
                                                <asp:LinkButton ID="linkAddDetail" CommandName="AddDetail" runat="server">Add</asp:LinkButton>
                                            </FooterTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                    <PagerSettings PageButtonCount="50" Position="TopAndBottom" />
                                </asp:GridView>
                            </div>
                        </td>
                    </tr>
                </ItemTemplate>
                <ItemStyle Width="10%" />
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
</div>
